<#-- 导入模版定义文件-->
<#include "../template/template_listPage.ftl">
<@header title="优先级管理">
<style type="text/css">
    .table {
        padding: 1px;
        text-align: center;
    }
</style>
<script type="text/javascript">
    function query() {
        $('#listForm').submit();
    }
    function saleStaticstics() {
        // window.open("${web_base}/recharge/card_management!saleStatistics.htm");
        ymPrompt.win('${web_base}/recharge/card_management!saleStatistics.htm', 600, 400, '销量统计', null, null, null, {id:'a'});
    }
    /**
     * 添加库存
     */
    function stockSupplierManagement() {
        ymPrompt.win('${web_base}/recharge/stock_supplier!list.htm', 600, 400, '进货源', null, null, null, {id:'b'});
    }
    function batchOperation() {
        ymPrompt.win('${web_base}/recharge/card_info!toBatchOperate.htm', 400, 150, '批量操作', null, null, null, {id:'b'});
    }
    function checkSort(sort) {
        var reg = /^[1-9]\d{0,2}$/;
       return reg.test(sort);

    }
    //修改优先级
    function updateSort(srmId) {
        var thisSort = $("#sort" + srmId).val();
        if(checkSort(thisSort))
        $.ajax({
            type:"POST",
            url:"${web_base}/recharge/priority!update.htm",
            data:"srm.sort=" +  thisSort+"&srm.id="+srmId,
            success:function (msg) {
                var b =eval('('+msg+')');
                if(msg)
                    alert("修改成功");
                else
                    alert("错误");
            }
        });
        else
        alert("请填写正确的优先级数字...");
    }
</script>
</@header>
<body class="list">
<div class="body">
    <div class="listBar">
        <h1><span class="icon">&nbsp;</span>优先级管理&nbsp;<span class="pageInfo">总记录数:<#if page??>${page.rowCount}</#if>
            (共<#if page??>${page.pageCount}</#if>页)</span></h1>
    </div>
<@pageList page=page id="listForm" action="" query="priorityQuery" isEmpty=true>
    <div class="operateBar">
    <#--  <label>产品名称:</label>
 <input type="text" name="cardName" value="${cardName!}" id="cardName"/>
 <button type="button" onclick="query();">查询</button> -->
    </div>
    <table class="listTable">
        <tr>
            <th><span class="sort">充值方式</span></th>
            <th><span class="sort">供应商</span></th>
            <th><span class="sort">类型（运营商）</span></th>
            <th><span class="sort">可冲区域</span></th>
            <th><span class="sort">可冲面额</span></th>
            <th><span class="sort">最小面额</span></th>
            <th><span class="sort">最大面额</span></th>
            <th><span class="sort">优先级</span></th>
            <th><span class="sort">操作</span></th>
        </tr>
        <#if page.list??>
            <#list page.list as obj>
                <tr>
                    <td>${obj.srmName!}</td>
                    <td>${obj.supplierName!}</td>
                    <td>${obj.operation!}</a></td>
                    <td>
                        <#list obj.area as row >
                            <#if row_index<=5>${(row)!}</#if>
                        </#list>
                        <#if 6<=obj.area.size()>...</#if>
                    </td>
                    <td>
                        <#list obj.faceValue as row >
                            <#if row_index<=5>${money((row)!)}</#if>
                        </#list>
                        <#if  6<=obj.faceValue.size()>...</#if>

                    </td>
                    <td>${money((obj.minAmount)!)}</td>
                    <td>${money((obj.maxAmount)!)}</td>
                    <td>
                        <input id="sort${obj.srmId!}" style="width: 50px;" value="${obj.sort!}" onblur="checkSort();"/>
                    </td>
                    <td><span class="spanLink" onclick="updateSort('${obj.srmId!}');">保存</span>&nbsp;&nbsp;
                    </td>
                </tr>
            </#list>
        </#if>
    </table>

</@pageList>
</div>
</body>
</html>